package main

import "fmt"

type Template interface {
	BoilWater()
	Brew()
	AddSugar()
	HashAddSugar() bool
}

type Coffee struct {
}

func (c *Coffee) BoilWater() {
	fmt.Println("煮沸水")
}

func (c *Coffee) Brew() {
	fmt.Println("冲泡咖啡")
}

func (c *Coffee) AddSugar() {
	fmt.Println("加糖")
}

func (c *Coffee) HashAddSugar() bool {
	return true
}

type Tea struct {
}

func (t *Tea) BoilWater() {
	fmt.Println("煮沸水")
}

func (t *Tea) Brew() {
	fmt.Println("冲泡茶")
}

func (t *Tea) AddSugar() {
	fmt.Println("加柠檬")
}

func (t *Tea) HashAddSugar() bool {
	return false
}

func MakeTemplate(t Template) {
	t.BoilWater()
	t.Brew()
	if t.HashAddSugar() {
		t.AddSugar()
	}
}

func main() {
	MakeTemplate(&Coffee{})
	fmt.Println("------------------")
	MakeTemplate(&Tea{})
}
